<template>
	<!-- 打印选择窗口 -->
	<view class="item-info" :class="showBillInfo === 0 ? 'none' : showBillInfo === 1 ? 'show' : ''">
		<view class="cate-content">
			<view class="item-fixed-top">
				<view class="title">{{title}}</view>
				<view class="close" @click="close">
					<image src="../../static/images/close.png" mode="scaleToFill"></image>
				</view>
			</view>
			<view class="cate-list">
				<view class="tip-txt" v-if="isShowLocalPrint">请选择云打印或本地有配置打印机也可选择本地打印。</view>
				<view class="tip-txt txt-p" v-else>使用云打印前, 请先设置好打印机配置。</view>
				<view class="btn">
					<view class="btns" @click="printType(1)" v-if="isShowLocalPrint">本地打印</view>
					<view class="btns" @click="printType(0)">云打印</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import staticConst from "../../js/const/StaticConst.js";
	import util from '../../js/util/Util.js';
	import config from "../../js/conf/Config.js";
	export default {
		data() {
			return {
				showBillInfo : 0,
				refuseTxt : "",//拒绝理由文本
				callBack:null,
				data:null,
				title:"打印选择",
				isShowLocalPrint:true,
			};
		},
		watch:{
			
		},
		methods: {
			/**显示分类面板 type:0付款记录，1：操作记录**/
			show(type,data) 
			{	
				let timer = type === 'show' ? 10 : 200;
				let state = type === 'show' ? 1 : 0;
				this.showBillInfo = 2;
				setTimeout(() => {
					this.showBillInfo = state;
				}, timer);
				
				if(data && data.hasOwnProperty('isLocal'))
				{
					this.isShowLocalPrint = data.isLocal;
				}
				else
				{
					this.isShowLocalPrint = true;
				}
				this.title = this.isShowLocalPrint ? "打印选择" : "打印提示";
			},
			
			close()
			{
				this.show();
			},
			
			/***打印方式选择****/
			printType(type)
			{
				this.$emit("printType",type);
				this.close();
			}
		},
	}
</script>
<style lang="scss">
	.item-info {
		position: fixed;
		z-index: 999;
		left: 0;
		top: 0;
		bottom: 0;
		width: 100%;
		background: #FFF;
		transition: 0.3s;
		overflow-y: hidden;
		display: flex;
		align-items: center;
		justify-content: center;
		.cate-content {
			border-radius: 6px;
			overflow: hidden;
			width: 300px;
			height: 150px;
			background: #F8F8F8;
			float: right;
			transform: translateY(-100%);
			transition: 0.3s;
			position: relative;
			.item-fixed-top
			{
				height: 50px;
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 14px;
				.title
				{
					font-size: 16px;
				}
				.close
				{
					position: absolute;
					right: 5px;
					top: 12px;
					width: 32px;
					height: 32px;
					text-align: center;
					cursor: pointer;
					image
					{
						width: 14px;
						height: 14px;
					}
				}
			}
		}
	
		&.none {
			display: none;
		}
		&.show {
			background: rgba(0, 0, 0, 0.3);
			.cate-content {
				transform: translateY(0);
			}
		}
	}
	.cate-list
	{
		padding: 0 10px;
		.tip-txt
		{
			font-size: 14px;
			padding-left: 10px;
			padding-right: 10px;
			color: #999;
		}
		
		.txt-p
		{
			padding: 15px 0;
			text-align: center;
		}
		
		.btn
		{
			height: 50px;
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: center;
			.btns:last-child
			{
				color: #3388FF;
			}
			.btns
			{
				cursor: pointer;
				flex: 1;
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 16px;
			}
		}
	}
</style>